\documentclass[a4paper,10pt]{article}


\begin{document}
\section{Gamma matrices and Dirac bilinears}
To construct the $\gamma$ matrices, we will use the Pauli spin matrices and the identity:
\begin{displaymath}
 I = \left(\begin{array}{cc} 1 & 0 \\ 0 & 1 \end{array}\right) \quad 
 \sigma^{1} = \left(\begin{array}{cc} 0 & 1 \\ 1 & 0 \end{array}\right) \quad 
 \sigma^{2} = \left(\begin{array}{cc} 0 & -i \\ i & 0 \end{array}\right) \quad 
 \sigma^{3} = \left(\begin{array}{cc} 1 & 0 \\ 0 & -1 \end{array}\right)
\end{displaymath}

We will use the GWC conventions for the gamma matrices. This means that:
\begin{displaymath}
 \gamma^{0}\equiv\gamma^{4} = \left(\begin{array}{cc}
 0 & -I \\
 -I & 0 \\
 \end{array}\right)
\quad \gamma^{1} = \left(\begin{array}{cc}
 0 & -i\sigma^{1} \\
 i\sigma^{1} & 0 \\
 \end{array}\right)
\end{displaymath}
\begin{displaymath}
\gamma^{2} = \left(\begin{array}{cc}
 0 & -i\sigma^{2} \\
 i\sigma^{2} & 0 \\
 \end{array}\right)
\quad \gamma^{3} = \left(\begin{array}{cc}
 0 & -i\sigma^{3} \\
 i\sigma^{3} & 0 \\
 \end{array}\right)
\end{displaymath}
Add the identity $I$ and $\gamma^{5}=\gamma^{0}\gamma^{1}\gamma^{2}\gamma^{3}$ for the scalar and the pseudoscalar:
\begin{displaymath}
 I = \left(\begin{array}{cc}
 I & 0 \\
 0 & I \\
 \end{array}\right)
\quad \gamma^{5} = \left(\begin{array}{cc}
 I & 0 \\
 0 & -I \\
 \end{array}\right)
\end{displaymath}
Then define as usual the axial bilinears $\gamma^{\mu}\gamma^{5}$:
\begin{displaymath}
 \gamma^{0}\gamma^{5} = \left(\begin{array}{cc}
 0 & I \\
 -I & 0 \\
 \end{array}\right)
\quad \gamma^{1}\gamma^{5} = \left(\begin{array}{cc}
 0 & i\sigma^{1} \\
 i\sigma^{1} & 0 \\
 \end{array}\right)
\end{displaymath}
\begin{displaymath}
\gamma^{2}\gamma^{5} = \left(\begin{array}{cc}
 0 & i\sigma^{2} \\
 i\sigma^{2} & 0 \\
 \end{array}\right)
\quad \gamma^{3}\gamma^{5} = \left(\begin{array}{cc}
 0 & i\sigma^{3} \\
 i\sigma^{3} & 0 \\
 \end{array}\right)
\end{displaymath}
Finally compute the tensor quantities $\sigma^{\mu\nu}=\frac{i}{2}\left[\gamma^{\mu},\gamma^{\nu}\right]$:
\begin{displaymath}
\sigma^{01} = \left(\begin{array}{cc}
 \sigma^{1} & 0 \\
 0 & -\sigma^{1} \\
 \end{array}\right)
\quad \sigma^{02} = \left(\begin{array}{cc}
 \sigma^{2} & 0 \\
 0 & -\sigma^{2} \\
 \end{array}\right)
\end{displaymath}
\begin{displaymath}
\sigma^{03} = \left(\begin{array}{cc}
 \sigma^{3} & 0 \\
 0 & -\sigma^{3} \\
 \end{array}\right)
\quad \sigma^{12} = \left(\begin{array}{cc}
 -\sigma^{3} & 0 \\
 0 & -\sigma^{3} \\
 \end{array}\right)
\end{displaymath}
\begin{displaymath}
\sigma^{13} = \left(\begin{array}{cc}
 \sigma^{2} & 0 \\
 0 & \sigma^{2} \\
 \end{array}\right)
\quad \sigma^{23} = \left(\begin{array}{cc}
 -\sigma^{1} & 0 \\
 0 & -\sigma^{1} \\
 \end{array}\right)
\end{displaymath}
There are then a set of rules to be applied in order to calculate any linear combination of Dirac matrices:
\begin{displaymath}
 \begin{array}{l}
 \gamma^{\mu}\gamma^{\mu}=1 \\
 \gamma^{5}\gamma^{5}=1 \\
 \{\gamma^{\mu},\gamma^{\nu}\}=0 \quad \Rightarrow \quad \gamma^{\mu}\gamma^{\nu}=-\gamma^{\nu}\gamma^{\mu} \\
 \{\gamma^{\mu},\gamma^{5}\}=0 \quad \Rightarrow \quad \gamma^{\mu}\gamma^{5}=-\gamma^{5}\gamma^{\mu} \\
 \sigma^{\mu\nu}=-\sigma^{\nu\mu}
\end{array}
\end{displaymath}
\subsection{Implementation}
Since all of these matrices are sparse, and non-zero entries can only be $(1, -1, i, -i)$, we store the matrices as a combination of a permutation and a sign. Multiplying with a gamma matrix or more generally any element of the Clifford algebra then simplifies to multiplication with the appropriate sign, and a permutation of the rows. While in general there could be $4!=24$ possible permutations, due to the diagonal or off diagonal block structure of the Clifford algebra, only $4$ permutations are actually occurring. These permutations are easily implemented, since an element needs never be swapped more than once. We list below the permutations, and the required swap operations:
\begin{displaymath}
 \begin{array}{l}
  0123 \\
  1032 \quad \textrm{swap}(0,1)\quad \textrm{swap}(2,3)\\
  2301 \quad \textrm{swap}(0,2)\quad \textrm{swap}(1,3)\\
  3210 \quad \textrm{swap}(0,3)\quad \textrm{swap}(1,2)
 \end{array}
\end{displaymath}

\end{document}
